/**
 * @projectName study-note
 * @package Composite
 * @className Composite.Leaf
 */
package Composite;

/**
 * Leaf
 * @description 叶子节点--没有子部门
 * @author answer_wx
 * @date 2022/7/4 10:14
 * @version 1.0
 */
public class Leaf extends Department {

    public Leaf(String name) {
        super(name);
    }

    @Override
    public void display(int depth) {
        StringBuilder stringBuilder = new StringBuilder();
        while (depth > 0) {
            stringBuilder.append("-");
            depth--;
        }
        System.out.println(stringBuilder + getName());
    }
}